Perl is a fast scripting language with superb text handling capabilies which make it ideal for CGIs. Furthermore Perl is a cross platform language which means that many scripts work without modification on different operating systems.Installing MacPerl
The complete instructions for installing Perl:
- Download MacPerl 5.1
- Unpack MacPerl
- Download PCGI.sit.bin
- Unpack PCGI.sit.bin
- Copy the file "MacHTTP CGI Script" into the folder "MacPerl Extensions" in either your MacPerl folder or in the preferences folder.
Examples
Example form.
Dump CGI Example This is the Perl version of the Dump CGI.
Paragraph Example The second example returns a complete web page which uses the arguements you pass from the form. Restricted Access CGI This CGI can provide secure web access. In this example a file (thefile.html) is in a folder called ReallyHidden inside the Hidden folder. The ReallyHidden folder contains private information: in this case it is visible, but only for demonstration purposes. With some modification to the script, the ReallyHidden folder could be located anywhere on the server: usually outside publically accessible spaces. To use these secure access methods, a file in the ReallyHidden hierachy is referenced as if it were in the Hidden folder. Since that file doesn't exist the missing.cgi CGI is executed (which is the Restriced Access CGI). The CGI returns the appropriate file from the ReallyHidden hierachy if the requesting browser is in a 'safe' domain (as defined in the script) or it has the appropriate password authorization.
This script needs a fair bit of customization to work correctly, and it needs some development, but it is a good example of what can be done with a clever CGI.
To see the script in action view this Top Secret file. You will probably need the Top Secret name (name) and password (password).